{% extends "base.html" %}

{% block exfile %}
    <!-- CKEditor -->
    <script src="{{ url_for('static', 
        filename='ckeditor/ckeditor.js') }}" 
        type="text/javascript">
    </script>
{% endblock %}

{% block page_content %}
<div class="page-header">
    <div align="center"><h1>用户主页</h1></div>
</div>
<div class="container">
    <div class="row" style='BORDER: 1px inset; padding:10px;'>
        <form method="POST" enctype="multipart/form-data">
        {{ form.csrf_token }}
        <table class="table table-bordered">
            <tr>
                <td colspan="4" >{{ form.course1(class='form-control') }}</td>
                <td colspan="2" >{{ form.score1(class='form-control') }}</td>
            </tr>
            <tr>
                <td colspan="4" >{{ form.course2(class='form-control') }}</td>
                <td colspan="2" >{{ form.score2(class='form-control') }}</td>
            </tr>
        </table>
        
        <!-- CKEditor插件 -->
        <div class="form-group">
            {{ form.body.label }}{{ form.body(class='form-control') }}
            <script type="text/javascript">{{ ckeditor.load() }}</script>
        </div>
        <!-- 开始、下载按钮（必须放在表单里，不然不刷新） -->
        <div class="form-group">
            <button name="submit" id="submit" 
                    type="submit" class="btn btn-success">
                <span class="glyphicon glyphicon-play"></span>开始
            </button>
            <!-- 开始按钮执行完成服务器段的代码后显示下载按钮组 -->
            {% if complete %}
            <a class="btn btn-primary" href="{{ fdocx }}">
                <span class="glyphicon glyphicon-download-alt"></span>
                下载
            </a>
            {% endif %}
        </div>
        </form>
    </div>
    <div class="text-muted text-right">
        第{{ visit }}次使用
    </div>
</div>
{% endblock %}